<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="text" id="grade">
  <button id="btn">点击</button>
</body>
<script>
  var gradeInp = document.getElementById("grade");
  var btn = document.getElementById("btn");

  // 判断分数的范围 是否在 0-150之间

  // 个位数: 0..9    01   09   001...009        0{0,2}\d
  // 两位数: 10-19 20-29 .... 90-99             0{0,1}[1-9]\d
  // 三位数: 100-109  110-109  .... 140-149     150   =>  1[0-4]\d|150  

  btn.onclick = function () {
    var grade = gradeInp.value * 1;  //  
    // var reg = /(^0{0,2}\d$)|([1-9]\d$)|(^1[0-4]\d|150$)/;
    var reg = /(^\d$)|([1-9]\d$)|(^1[0-4]\d|150$)/;
    console.log(reg.test(grade));
  }

</script>

</html>